// 库存相关API
window.inventoryAPI = {
    // 获取库存列表
    getInventory: async (params = {}) => {
        try {
            const response = await apiClient.get('/api/inventory/', { params });
            return response;
        } catch (error) {
            console.error('获取库存列表失败:', error);
            throw error;
        }
    },
    
    // 获取商品库存
    getProductInventory: async (productId) => {
        try {
            const response = await apiClient.get(`/api/inventory/${productId}`);
            return response;
        } catch (error) {
            console.error('获取商品库存失败:', error);
            throw error;
        }
    },
    
    // 更新库存
    updateInventory: async (data) => {
        try {
            const response = await apiClient.post('/api/inventory/update', data);
            return response;
        } catch (error) {
            console.error('更新库存失败:', error);
            throw error;
        }
    },
    
    // 获取库存统计
    getStatistics: async () => {
        try {
            const response = await apiClient.get('/api/inventory/statistics');
            return response;
        } catch (error) {
            console.error('获取库存统计失败:', error);
            throw error;
        }
    },
    
    // 获取低库存商品
    getLowStockProducts: async () => {
        try {
            const response = await apiClient.get('/api/inventory/low-stock');
            return response;
        } catch (error) {
            console.error('获取低库存商品失败:', error);
            throw error;
        }
    }
};
